#include "Return.h"
#include "IVisitor.h"

Return::Return(const exprTypePtr& value, int nodeId):
    stmtType(nodeId),
    _value(value)
{
}
    
Return::~Return()
{
    
}
    
QString Return::type() const
{
    return "Return";
}
    

exprTypePtr Return::value()
{
    return _value;
}

void Return::setValue(const exprTypePtr& value)
{
    _value = value;
}

    
QString Return::toString() const
{
    return QString("Return[value=%1]").
                arg(_value ? _value->toString():"");
}
    
void Return::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitReturn(node.dynamicCast<Return>());
}
    
void Return::traverse(IVisitor* visitor)
{
    if (_value != NULL)
        _value->accept(visitor, _value);
}